<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddSomethingToUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn("name");
            $table->dropColumn("email");
            $table->string('phone')->nullable()
                ->comment("用户手机号")
                ->unique();
            $table->string("phone_s")->nullable()
                ->comment("用户手机号2");
            $table->string("phone_t")->nullable();
            $table->dateTime("log_time")->nullable()
                ->comment("最后一次登录时间");
            $table->string("nickname")->nullable()
                ->comment("用户昵称");
            $table->boolean("l_m")->default(0)
                ->nullable()->comment("到没到馆 默认没有 0无 1有");
            $table->integer("come_from")->default(1)
                ->comment("来源1小程序 2二维码 3 后台注册 4公众号 5PC");
            $table->integer("cate_type")->nullable()
                ->comment("用户类型ABC啥的")->index();
            $table->boolean("no_short_msg")->default(0)
                ->comment("免短信登录")->nullable();
            $table->integer("birthday_year")->nullable()
                ->comment("生日 年");
            $table->string("birthday_md")->nullable()
                ->comment("生日 月日");
            $table->string("address")->nullable()->comment("用户地址");
            $table->string("address_detail")->nullable()->comment("详细地址");
            $table->boolean("has_wx")->nullable()->comment("有无微信 0无 1有");
            $table->string("car_type")->nullable()->comment("车型");
            $table->string("hobby")->nullable()->comment("爱好");
            $table->integer("location_id")->index()->nullable()
                ->comment("外联岗点，部分有用");
            $table->string("mark")->nullable()->comment("备注");
            $table->string("location_address")
                ->nullable()
                ->comment("来源，自定义 用于新系统");
            $table->integer("sex")->nullable()->default(3)
                ->comment("性别，1男2女3未知");
            $table->integer("deal_time")->nullable()->comment("成交年份");
            $table->string("unionid")->index()->nullable()->comment("微信端的总体的唯一标识");
            $table->string("web_openid")->index()->nullable()->comment("公众号唯一标识");
            $table->string("mini_openid")->index()->nullable()->comment("小程序唯一标识");
            $table->string("password")->nullable()->comment("密码")->change();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            //
        });
    }
}
